//
//  ProcessImageCell.swift
//  QualityControlSystem
//
//  Created by Daniel Hu on 1/17/17.
//  Copyright © 2017 com.mask. All rights reserved.
//

import Photos

class ProcessImageCell: UICollectionViewCell {
    
    var asset: PHAsset? {
        willSet {
            let imageManager = PHImageManager()
            let options = PHImageRequestOptions()
            imageManager.requestImageData(for: newValue!, options: options, resultHandler: { data, string, orientation, info in
                self.imageView.image = UIImage(data: data!)
            })
        }
    }
    let imageView = UIImageView()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        imageView.backgroundColor = UIColor.white
        imageView.layer.cornerRadius = 10
        imageView.layer.masksToBounds = true
        imageView.frame = contentView.frame
        contentView.addSubview(imageView)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
